﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MonPocGarage.ArmyContracts.Common.Enums;

namespace MonPocGarage.ArmyContracts.Common.Abilities
{
    public class Trigger : IAbility
    {
        private AbilityColor m_AbilityColor;
        private AttackType m_AttackType;

        private readonly string m_AbilityID;
        private readonly TriggerType m_TriggerType;
        private readonly string m_AbilityName;
        private readonly string m_AbilityDescription;
        private readonly string m_ImagePath;

        public string AbilityID
        {
            get { return m_AbilityID; }
        }

        public AbilityType AbilityType
        {
            get { return AbilityType.Trigger; }
        }

        public AbilityColor AbilityColor
        {
            get { return m_AbilityColor; }
        }

        public AttackType AttackType
        {
            get { return m_AttackType; }
        }

        public string AbilityName
        {
            get { return m_AbilityName; }
        }

        public string AbilityDescription
        {
            get { return m_AbilityDescription; }
        }

        public TriggerType TriggerType
        {
            get { return m_TriggerType; }
        }

        public string ImagePath
        {
            get { return m_ImagePath; }
        }

        public void ChangeColor(AbilityColor newColor)
        {
            m_AbilityColor = newColor;
        }

        public void ChangeAttackType(AttackType attackType)
        {
            m_AttackType = attackType;
        }

        public Trigger(string abilityName, string abilityDescription, AbilityColor color, TriggerType triggerType)
        {
            m_AbilityColor = color;
            m_AbilityName = abilityName;
            m_AbilityDescription = abilityDescription;
            m_TriggerType = triggerType;
            m_ImagePath = BuildImagePath();
            m_AbilityID = m_AbilityName.Replace(" ", string.Empty);
            m_AttackType = AttackType.None;
        }

        public Trigger(Trigger another)
        {
            m_AbilityColor = another.AbilityColor;
            m_AbilityName = another.AbilityName;
            m_AbilityDescription = another.AbilityDescription;
            m_TriggerType = another.TriggerType;
            m_ImagePath = BuildImagePath();
            m_AbilityID = m_AbilityName.Replace(" ", string.Empty);
            m_AttackType = another.AttackType;
        }

        private string BuildImagePath()
        {
            string imagePath = "Images/Abilities/Actions/Triggers/" + m_AbilityName + "_";
            return imagePath;
        }

        public object Clone()
        {
            return new Trigger(this);
        }
    }
}
